<template>
  <div>
    <h2>用户登录列表</h2>
    <table class="table" border="1">
      <tr>
        <td>用户名</td>
        <td>密码</td>
        <td>注册时间</td>
      </tr>
      <tr v-for="item in list">
        <td>{{item.Uname}}</td>
        <td>{{item.Upwd.substring(0,4)+"***"}}</td>
        <td>{{item.Udate.substring(0,10)}}</td>
      </tr>
    </table>
  </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import {reactive,toRefs,onMounted} from 'vue'
let data=reactive({
  state:{
    Uname:"",
    Upwd:""
  },
  list:{}
})
let {state,list}=toRefs(data)
onMounted(()=>{
  getlist()
})
function getlist()
{
  axios({
    url:"http://localhost:51322/api/User/GetUserLoginList",
    method:"get",
  })
  .then(res=>{
    console.log(res);
    list.value=res.data.data
  })
  .catch(err=>{
    console.log(err);
  })
}
</script>

<style scoped>

</style>